/**
 * @Date 2023-02-22 17:30:38
 * @Remark
 */

// react
import React from "react";
// lib
import { Image, Typography } from "antd";
import { FillImage } from "config/setting";
// config
// style

const { Text } = Typography;

export default function ShowImage(props: {
  src?: string | null;
  width?: number | string | undefined;
  height?: number | string | undefined;
}) {
  const { src, width, height } = props;

  if (!src || src === "") {
    return (
      <div
        style={{
          width,
          height,
          display: "flex",
          alignItems: "center",
          justifyContent: "center",
        }}
      >
        <Text type="danger">无图片</Text>
      </div>
    );
  }

  return <Image width={width} height={height} src={src} fallback={FillImage} />;
}
